/*******************************************************************/
/* @ All Rights Reserved Copyright (C) 2014 broada,Co.,Ltd.        */
/*                                                                 */
/*  NAME      = ora_mar_engine.c                                   */
/*  NOTE      =                                                    */
/*  DATE      = 2014/09/26 by guojq                                */
/*******************************************************************/

#ifndef __ORA_MAR_ENGINE_H_
#define __ORA_MAR_ENGINE_H_

int ora_mar_check_bufflen(L7_ora_packet *p_st_ora_packet, unsigned long long ull_need_len);
int ora_mar_check_bufflen_from(L7_ora_packet *p_st_ora_packet, unsigned int ui_from, unsigned long long ull_need_len);
int ora_mar_skip(L7_ora_packet *p_st_ora_packet, unsigned long long ull_need_len);
int ora_mar_escapeSequenceNull(int i_param, int *p_i_out);
int ora_mar_unmarshalUB1(L7_ora_packet *p_st_ora_packet, short *p_s_out);
int ora_mar_unmarshalSB1(L7session_ora *p_st_sess, L7_ora_packet *p_st_ora_packet, char *p_out);
int ora_mar_unmarshalUB2(L7session_ora *p_st_sess, L7_ora_packet *p_st_ora_packet, int *p_i_out);
int ora_mar_unmarshalSB2(L7session_ora *p_st_sess, L7_ora_packet *p_st_ora_packet, short *p_s_out);
int ora_mar_unmarshalUB4(L7session_ora *p_st_sess, L7_ora_packet *p_st_ora_packet, long long *p_ll_out);
int ora_mar_unmarshalSB4(L7session_ora *p_st_sess, L7_ora_packet *p_st_ora_packet, int *p_i_out);
int ora_mar_unmarshalSB8(L7session_ora *p_st_sess, L7_ora_packet *p_st_ora_packet, long long *p_ll_out);
int ora_mar_unmarshalSWORD(L7session_ora *p_st_sess, L7_ora_packet *p_st_ora_packet, int *p_i_out);
int ora_mar_unmarshalUWORD(L7session_ora *p_st_sess, L7_ora_packet *p_st_ora_packet, long long *p_ll_out);
int ora_mar_unmarshalNBytes_by_len(int i_len, L7_ora_packet *p_st_ora_packet, char **pp_out_buff);
int ora_mar_unmarshalNBytes(Frstr *p_outbuff, int i_len_to_read, L7_ora_packet *p_st_ora_packet, int *p_i_out);
int ora_mar_unmarshalBuffer(Frstr *p_outbuff, int i_param_size, int i_param1, int i_param2, L7_ora_packet *p_st_ora_packet, int *p_i_out);
int ora_mar_unmarshalCLR_ttc(L7_ora_packet *p_st_ora_packet, char **pp_out, int *p_i_out_len);
int ora_mar_unmarshalCLR(int i_param, int *p_arr_int, L7session_ora *p_st_sess, L7_ora_packet *p_st_ora_packet, char **pp_out, int *p_i_out_len);
int ora_mar_unmarshalCHR(int i_param, L7session_ora *p_st_sess, L7_ora_packet *p_st_ora_packet, char **pp_out, int *p_i_out_len);
int ora_mar_unmarshalDALC(L7session_ora *p_st_sess, L7_ora_packet *p_st_ora_packet, char **pp_out, int *p_i_out_len);
int ora_mar_unmarshalCLRforREFS(L7session_ora *p_st_sess, L7_ora_packet *p_st_ora_packet, char **pp_out, int *p_i_out_len);

int ora_mar_readLongLSB_12c_pkt(int i_len_to_read, L7session_ora *p_st_sess, L7_ora_packet *p_st_ora_packet, long long *p_ll_out);
int ora_mar_readLongMSB_12c_pkt(int i_len_to_read, L7session_ora *p_st_sess, L7_ora_packet *p_st_ora_packet, long long *p_ll_out);
int ora_mar_readLongLSB_12c(int paramInt, L7session_ora *p_st_sess, L7_ora_packet *p_st_ora_packet, long long *p_ll_out);
int ora_mar_readLongMSB_12c(int paramInt, L7session_ora *p_st_sess, L7_ora_packet *p_st_ora_packet, long long *p_ll_out);
int ora_mar_buffer2Value_12c_one(int i_param, L7session_ora *p_st_sess, L7_ora_packet *p_st_ora_packet, long long *p_ll_out);

int ora_mar_unmarshalO2U(L7session_ora *p_st_sess, L7_ora_packet *p_st_ora_packet, char *p_out);
int ora_mar_unmarshalB1Array(int i_param, L7_ora_packet *p_st_ora_packet, char **pp_out);
int ora_mar_unmarshalKEYVAL(int i_param, L7session_ora *p_st_sess, L7_ora_packet *p_st_ora_packet);
int ora_mar_unmarshalKeywordValue(L7session_ora *p_st_sess, L7_ora_packet *p_st_ora_packet);
int ora_mar_unmarshalUB4Array(int i_arr_len, L7session_ora *p_st_sess, L7_ora_packet *p_st_ora_packet);
int ora_mar_unmarshalUCS2(L7session_ora *p_st_sess, L7_ora_packet *p_st_ora_packet, int *p_i_out);

int ora_mar_skipUB1(L7_ora_packet *p_st_ora_packet);
int ora_mar_skipO2U(L7session_ora *p_st_sess, L7_ora_packet *p_st_ora_packet);
int ora_mar_skipUB2(L7session_ora *p_st_sess, L7_ora_packet *p_st_ora_packet);
int ora_mar_skipSB2(L7session_ora *p_st_sess, L7_ora_packet *p_st_ora_packet);
int ora_mar_skipUB4(L7session_ora *p_st_sess, L7_ora_packet *p_st_ora_packet);
int ora_mar_skipSB4(L7session_ora *p_st_sess, L7_ora_packet *p_st_ora_packet);
int ora_mar_skipNBytes_by_len(int i_len, L7_ora_packet *p_st_ora_packet);
int ora_mar_skipB1Array(int i_param, L7_ora_packet *p_st_ora_packet);
int ora_mar_skipNBytes(int i_len_to_read, L7_ora_packet *p_st_ora_packet);
int ora_mar_skipTEXT(int i_len, L7_ora_packet *p_st_ora_packet);
int ora_mar_skipCLR(L7session_ora *p_st_sess, L7_ora_packet *p_st_ora_packet);
int ora_mar_skipCLRLen(L7session_ora *p_st_sess, L7_ora_packet *p_st_ora_packet, int *p_i_isnull);
int ora_mar_skipCHR(int i_param, L7session_ora *p_st_sess, L7_ora_packet *p_st_ora_packet);
int ora_mar_skipDALC(L7session_ora *p_st_sess, L7_ora_packet *p_st_ora_packet);
int ora_mar_skipbuffer2Value_12c_one(int i_param, L7session_ora *p_st_sess, L7_ora_packet *p_st_ora_packet);

int ora_mar_peekUB1(L7_ora_packet *p_st_ora_packet, short *p_s_out);
int ora_mar_peekUB2(L7_ora_packet *p_st_ora_packet, short *p_s_out);

#endif
